package com.alks.function.controller.biocontrol.deptwork;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.entity.data.entity.CpCutInfo;
import com.alks.entity.data.entity.CpCutPart;
import com.alks.entity.data.entity.CpCutStyle;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.service.biocontrol.deptwork.ICpCutService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@ApiRestController("/bioDeptWrok")
@Api(value = "生控作业", tags = "生控部-生控作业-冲刀资料建档")
@RequiredArgsConstructor
@RoleCheck(prgIds = "140119")
public class CpCutController {
    private final ICpCutService service;

    @PostMapping("/getCpCutQuery")
    @ApiOperation(value = "冲刀资料查询-可条件查询", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo getCpCutQuery(@RequestParam@ApiParam("型体") String style) {
        return service.getCpCutQuery(style);
    }

    @PostMapping("/cpCutAdd")
    @ApiOperation(value = "冲刀资料新增-新增", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo cpCutAdd(@RequestBody CpCutInfo request) {
        return service.cpCutAdd(request);
    }

    @PostMapping("/cpCutUp")
    @ApiOperation(value = "冲刀资料更新-更新", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo cpCutUp(@RequestBody CpCutInfo request,
                                @RequestParam@ApiParam("订单标志位") String slipFlag,
                                @RequestParam@ApiParam("冲刀号（旧）") String cutNoOld) {
        return service.cpCutUp(request,slipFlag,cutNoOld);
    }

    @PostMapping("/cpCutDel")
    @ApiOperation(value = "冲刀资料删除-删除", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo cpCutDel(@RequestParam@ApiParam("订单标志位") String slipFlag,
                                 @RequestParam@ApiParam("冲刀号") String cutNo) {
        return service.cpCutDel(slipFlag,cutNo);
    }

    @PostMapping("/getCpCutDetQuery")
    @ApiOperation(value = "冲刀部位资料查询-条件查询", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo getCpCutDetQuery(@RequestParam@ApiParam("冲刀号") String cutNo) {
        return service.getCpCutDetQuery(cutNo);
    }

    @PostMapping("/cpCutDetAdd")
    @ApiOperation(value = "冲刀部位资料新增-新增", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo cpCutDetAdd(@RequestBody CpCutPart request) {
        return service.cpCutDetAdd(request);
    }

    @PostMapping("/cpCutDetUp")
    @ApiOperation(value = "冲刀部位资料更新-更新", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo cpCutDetUp(@RequestBody CpCutPart request,
                                   @RequestParam@ApiParam("订单标志位") String slipFlag,
                                   @RequestParam@ApiParam("冲刀号（旧）") String cutNoOld,
                                   @RequestParam@ApiParam("部位(旧)") String partNameOld) {
        return service.cpCutDetUp(request,slipFlag,cutNoOld, partNameOld);
    }

    @PostMapping("/cpCutDetDel")
    @ApiOperation(value = "冲刀部位资料删除-删除", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo cpCutDetDel(@RequestParam@ApiParam("订单标志位") String slipFlag,
                                    @RequestParam@ApiParam("冲刀号") String cutNo,
                                    @RequestParam@ApiParam("部位") String partName) {
        return service.cpCutDetDel(slipFlag,cutNo, partName);
    }

    @PostMapping("/getCpCutStyleQuery")
    @ApiOperation(value = "冲刀所用型体查询-条件查询", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo getCpCutStyleQuery(@RequestParam@ApiParam("冲刀号") String cutNo) {
        return service.getCpCutStyleQuery(cutNo);
    }

    @PutMapping("/cpCutStyleAdd")
    @ApiOperation(value = "冲刀所用型体新增-新增", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo cpCutStyleAdd(@RequestBody List<String> style,
                                      @RequestParam@ApiParam("冲刀号") String cutNo) {
        return service.cpCutStyleAdd(style,cutNo);
    }

    @PostMapping("/cpCutStyleUp")
    @ApiOperation(value = "冲刀所用型体更新-更新", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo cpCutStyleUp(@RequestBody CpCutStyle request,
                                     @RequestParam@ApiParam("冲刀号(旧)") String cutNoOld,
                                     @RequestParam@ApiParam("型体（旧）") String styleOld) {
        return service.cpCutStyleUp(request,cutNoOld,styleOld);
    }

    @PostMapping("/cpCutStyleDel")
    @ApiOperation(value = "冲刀所用型体删除-删除", tags = "生控部-生控作业-冲刀资料建档")
    public ResponseInfo cpCutStyleDel(@RequestParam@ApiParam("冲刀号") String cutNo,
                                      @RequestParam@ApiParam("型体") String style) {
        return service.cpCutStyleDel(cutNo,style);
    }


}
